home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / pp_action.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  6.5 KB  |  217 lines

  1. ∩╗┐<%@ Language=VBScript CODEPAGE=65001 %>
  2. <!--#include file="include/wmsConstants.inc"-->
  3. <!--#include file="include/wmsLocStrings.inc"-->
  4. <!--#include file="include/wmsCommon.inc"-->
  5. <!--#include file="include/wmsServerHash.inc"-->
  6. <!--#include file="include/wmsconnect.inc"-->
  7. <!--#include file="include/wmsError.inc"-->
  8. <%
  9. '+-------------------------------------------------------------------------
  10. '
  11. '  Microsoft Windows Media
  12. '  Copyright (C) Microsoft Corporation. All rights reserved.
  13. '
  14. '  File:       PP_Action.asp
  15. '
  16. '  Contents:
  17. '
  18. '--------------------------------------------------------------------------
  19.  
  20. ConnectToServer
  21. ConnectToPubPoint
  22.  
  23. '
  24. '  Here, we collect a bunch of common code.  This allows us to re-use code between multiple tabs simply
  25. '   by calling Request.Transfer pp_action.asp, etc.
  26. '
  27. on error resume next
  28. Dim strOp
  29. Dim bUpdateTreeView
  30. Dim qsSuffix
  31.  
  32. bUpdateTreeView = FALSE
  33. qsSuffix = ""
  34.  
  35. err.Clear
  36. strOp = lcase( RemoveDangerousCharacters( qs("op") ) )
  37.     
  38. select case strOp
  39.     case "start"
  40.         PPStartStop "start"
  41.         bUpdateTreeView = TRUE
  42.     case "stop"
  43.         PPStartStop "stop"
  44.         bUpdateTreeView = TRUE
  45.     case "startarchiving"
  46.         PPStartStopArchiving "start"
  47.     case "stoparchiving"
  48.         PPStartStopArchiving "stop"
  49.     case "rampdown"
  50.         PPStartStop "rampdown"
  51.     case "allow"
  52.         PPAllowDeny "allow"
  53.         bUpdateTreeView = TRUE
  54.     case "deny"
  55.         PPAllowDeny "deny"
  56.         bUpdateTreeView = TRUE
  57.     case "delete"
  58.         PPDelete
  59.         bUpdateTreeView = TRUE
  60.     case Else
  61.         if g_bDebugMode then
  62.             STOP
  63.         end if
  64. end select
  65.  
  66. Session( "bUpdateTreeView" ) = bUpdateTreeView
  67. if( ErrorDetected( strOp ) ) then
  68.     Session( "PageReloadedToDisplayError" ) = 1
  69.     qsSuffix = "&error=" & Session( "ErrorNumber" )
  70. end if
  71.  
  72. strReferrer = CStr( qs("referrer") )
  73. if( 0 = Len( strReferrer ) ) then
  74.     Response.Redirect( "pubpoint_collection.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & qsSuffix )
  75. ' Don't do a server-side transfer, as we need to clean up the query string so that the refresh timer doesn't invoke redundant commands
  76. '    Server.Transfer( "pubpoint_collection.asp" )
  77. else
  78.     if( 0 <> Session( "ErrorNumber" ) ) then
  79.         Response.Redirect( SafeUnescape( strReferrer ) & "?" & qs & qsSuffix )
  80.     else
  81.         Server.Transfer( strReferrer )
  82.     end if
  83. end if
  84.  
  85. '/////////////////////////////////////////////////////////////////////////////////////
  86. ' PPDelete
  87. ' -------------
  88. ' Deletes a publishing point
  89. Sub PPDelete()
  90.     g_objServer.PublishingPoints.Remove( g_objPubPoint.Name )
  91.  
  92.     if ErrorDetected( strOp ) then
  93.         Session( "PageReloadedToDisplayError" ) = 1
  94.     end if
  95.     
  96.     Session( "bUpdateTreeView" ) = 1
  97.     Server.Transfer( "pubpoint_collection.asp" )
  98. end sub
  99.  
  100. '/////////////////////////////////////////////////////////////////////////////////////
  101. ' PPStartStopArchiving
  102. ' -------------
  103. ' Starts or stops the archiving of a broadcast pub point
  104. sub PPStartStopArchiving( strOp )
  105.  
  106.     if( 0 = StrComp( "start", strOp, vbTextCompare ) ) then
  107.         if( WMS_PUBLISHING_POINT_TYPE_BROADCAST = g_objPubPoint.Type ) then
  108.             g_objPubPoint.StartArchive
  109.         end if
  110.     elseif ( 0 = StrComp( "stop", strOp, vbTextCompare ) ) then
  111.         if( WMS_PUBLISHING_POINT_TYPE_BROADCAST = g_objPubPoint.Type ) then
  112.             g_objPubPoint.StopArchive
  113.         end if
  114.     end if
  115.     
  116.     if( 0 <> Err.number ) then
  117.         ErrorDetected( "archive" )
  118.         Session( "PageReloadedToDisplayError" ) = 1        
  119.     end if
  120.     
  121.     if ErrorDetected( strOp ) then
  122.         Session( "PageReloadedToDisplayError" ) = 1
  123.     end if
  124. end sub
  125.  
  126. '/////////////////////////////////////////////////////////////////////////////////////
  127. ' PPStartStop
  128. ' -------------
  129. ' Enables or disables a list of publishing points
  130. Sub PPStartStop( strOp)
  131.     Dim i
  132.     Dim bAllowingClientsToConnect
  133.  
  134.     if( 0 = StrComp( "start", strOp, vbTextCompare ) ) then
  135.         if( WMS_PUBLISHING_POINT_TYPE_ON_DEMAND <> g_objPubPoint.Type ) then
  136.             g_objPubPoint.Start
  137.         end if
  138.     elseif ( 0 = StrComp( "stop", strOp, vbTextCompare ) ) then
  139.  
  140.         bAllowingClientsToConnect = g_objPubPoint.AllowClientsToConnect
  141.         g_objPubPoint.AllowClientsToConnect = FALSE
  142.         if( WMS_PUBLISHING_POINT_TYPE_ON_DEMAND <> g_objPubPoint.Type ) then
  143.             g_objPubPoint.Stop
  144.         end if
  145.         g_objPubPoint.AllowClientsToConnect = bAllowingClientsToConnect
  146.  
  147.     elseif ( 0 = StrComp( "rampdown", strOp, vbTextCompare ) ) then
  148.         Dim players
  149.         Dim aPlayer
  150.         Dim dwNumPlayers
  151.  
  152.         bAllowingClientsToConnect = g_objPubPoint.AllowClientsToConnect
  153.         g_objPubPoint.AllowClientsToConnect = FALSE
  154.         set players = g_objPubPoint.Players
  155.         
  156.         dwNumPlayers = players.Count
  157.         for i = ( dwNumPlayers - 1 ) to 0 step -1
  158.             players.Remove( i )
  159.         next
  160.  
  161.         for each player in players
  162.             players.Remove( player )
  163.         next
  164.         
  165.         g_objPubPoint.AllowClientsToConnect = bAllowingClientsToConnect
  166.         err.clear
  167.  
  168.     end if
  169.  
  170.     if ErrorDetected( strOp ) then
  171.         Session( "PageReloadedToDisplayError" ) = 1
  172.     end if
  173. end sub
  174.  
  175.  
  176. '/////////////////////////////////////////////////////////////////////////////////////
  177. ' PPAllowDeny
  178. ' -------------
  179. ' Enables clients to connect or disables clients from connecting to a list of publishing points
  180. Sub PPAllowDeny( strOp )
  181.     Dim bBroadcastPubPoint
  182.     Dim dwPPType
  183.     
  184.     dwPPType = g_objPubPoint.Type
  185.  
  186.     if WMS_PUBLISHING_POINT_TYPE_BROADCAST = dwPPType then
  187.         bBroadcastPubPoint = true
  188.     end if
  189.  
  190.     if( 0 = StrComp( "allow", strOp, vbTextCompare ) ) then
  191.         g_objPubPoint.AllowClientsToConnect = TRUE
  192.         if not ErrorDetected( "PPAllowConnect" ) then
  193.             if bBroadcastPubPoint then
  194.                 if ErrorDetected( "PPStart" ) then
  195.                 end if
  196.             end if
  197.         end if
  198.     elseif( 0 = StrComp( "deny", strOp, vbTextCompare ) ) then
  199.         g_objPubPoint.AllowClientsToConnect = FALSE
  200.         if not ErrorDetected( "PPDenyConnect" ) then
  201.             if bBroadcastPubPoint then
  202.                 if ErrorDetected( "PPStop" ) then
  203.                 end if
  204.             end if
  205.         end if
  206.     end if  
  207.     
  208.     if( 0 <> Err.number ) then
  209.         ErrorDetected( "" )
  210.         Session( "PageReloadedToDisplayError" ) = 1        
  211.     end if
  212. End Sub
  213.  
  214. WMSServerHashASPCleanup
  215. WMSConnectASPCleanup
  216. %>  
  217.